package com.fannt.example.exintent;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {
	EditText ed1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ed1=(EditText) findViewById(R.id.ed1);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    public void cal(View v) {
    	if(ed1.getText()!=null){
		Intent c=new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+ed1.getText()));
		startActivity(c);}
	}
    public void sms(View v) {
		Intent s=new Intent(Intent.ACTION_SENDTO);
		s.putExtra("smsto", "911");
		s.putExtra("sms_body", "aaaa");
		startActivity(s);
	}
    public void mail(View v) {
		Intent s=new Intent(Intent.ACTION_SEND);
		s.putExtra(Intent.EXTRA_EMAIL, "fan127456@gmail.com");
		s.putExtra(Intent.EXTRA_SUBJECT, "Gop y");
		s.putExtra(Intent.EXTRA_TEXT, "aaaaa");
		startActivity(s);
	}
    public void web(View v) {
		Intent w= new Intent(Intent.ACTION_VIEW,Uri.parse("http://dantri.com.vn"));
		startActivity(w);
		
	}
    public void lan(View v) {
		Intent l =new Intent(android.provider.Settings.ACTION_LOCALE_SETTINGS);
		startActivity(l);
	}
}
